﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;


namespace _0712502_0712504_DesignPatternGame
{
    public class TerrainItem
    {
        public int _idItem; // ID cua terrain
        public StateInUse StateUsed;    // trang thai dang su dung
        public int LifePower;

        public Rectangle CollisionRect;
        public Point Size;
        public Point Position;
        public Texture2D[] _textures;
        public TerrainItem(int id, Texture2D[] textures, int lifePower, int posX, int posY, Point size, Point collisionRect)
        {
            _idItem = id;
            _textures = textures;
            StateUsed = StateInUse.Using;
            LifePower = lifePower;

            Size = size;
            Position.X = posX;
            Position.Y = posY;
            CollisionRect = new Rectangle(posX, posY+9, 27, 27);
        }

        public void Update()
        {
            if (this.LifePower > 0)
            {
                this.StateUsed = StateInUse.Using;
            }
            // pinDNS;
            else
            {
                this.StateUsed = StateInUse.NotUsed;
            }

        }

        public void DrawToScreen(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (LifePower > 0)
                spriteBatch.Draw(_textures[LifePower - 1], new Rectangle(Position.X, Position.Y, Size.X, Size.Y), Color.White);
        }
    }
}
